/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.impl;

import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.And;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.BusinessMessage;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Cancel;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Compensation;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Condition;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Correlation;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.If;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.InteractionPath;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.InteractionProtocol;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.InteractionprotocolsFactory;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.InteractionprotocolsPackage;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Lifeline;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Loop;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.LoopType;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.MultipleInstance;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.MultipleInstancesType;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Or;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.ProtocolReference;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Role;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.SynchronizationType;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Termination;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.TerminationElement;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.TimeConstraint;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.TimeObservation;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Transaction;
import ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Xor;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class InteractionprotocolsFactoryImpl extends EFactoryImpl implements InteractionprotocolsFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static InteractionprotocolsFactory init() {
		try {
			InteractionprotocolsFactory theInteractionprotocolsFactory = (InteractionprotocolsFactory)EPackage.Registry.INSTANCE.getEFactory("ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols"); 
			if (theInteractionprotocolsFactory != null) {
				return theInteractionprotocolsFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new InteractionprotocolsFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InteractionprotocolsFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case InteractionprotocolsPackage.BUSINESS_MESSAGE: return createBusinessMessage();
			case InteractionprotocolsPackage.INTERACTION_PROTOCOL: return createInteractionProtocol();
			case InteractionprotocolsPackage.INTERACTION_PATH: return createInteractionPath();
			case InteractionprotocolsPackage.LIFELINE: return createLifeline();
			case InteractionprotocolsPackage.TERMINATION: return createTermination();
			case InteractionprotocolsPackage.CONDITION: return createCondition();
			case InteractionprotocolsPackage.TIME_CONSTRAINT: return createTimeConstraint();
			case InteractionprotocolsPackage.TIME_OBSERVATION: return createTimeObservation();
			case InteractionprotocolsPackage.PROTOCOL_REFERENCE: return createProtocolReference();
			case InteractionprotocolsPackage.CORRELATION: return createCorrelation();
			case InteractionprotocolsPackage.ROLE: return createRole();
			case InteractionprotocolsPackage.AND: return createAnd();
			case InteractionprotocolsPackage.OR: return createOr();
			case InteractionprotocolsPackage.XOR: return createXor();
			case InteractionprotocolsPackage.IF: return createIf();
			case InteractionprotocolsPackage.LOOP: return createLoop();
			case InteractionprotocolsPackage.EXCEPTION: return createException();
			case InteractionprotocolsPackage.CANCEL: return createCancel();
			case InteractionprotocolsPackage.MULTIPLE_INSTANCE: return createMultipleInstance();
			case InteractionprotocolsPackage.TRANSACTION: return createTransaction();
			case InteractionprotocolsPackage.COMPENSATION: return createCompensation();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case InteractionprotocolsPackage.TERMINATION_ELEMENT:
				return createTerminationElementFromString(eDataType, initialValue);
			case InteractionprotocolsPackage.LOOP_TYPE:
				return createLoopTypeFromString(eDataType, initialValue);
			case InteractionprotocolsPackage.MULTIPLE_INSTANCES_TYPE:
				return createMultipleInstancesTypeFromString(eDataType, initialValue);
			case InteractionprotocolsPackage.SYNCHRONIZATION_TYPE:
				return createSynchronizationTypeFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case InteractionprotocolsPackage.TERMINATION_ELEMENT:
				return convertTerminationElementToString(eDataType, instanceValue);
			case InteractionprotocolsPackage.LOOP_TYPE:
				return convertLoopTypeToString(eDataType, instanceValue);
			case InteractionprotocolsPackage.MULTIPLE_INSTANCES_TYPE:
				return convertMultipleInstancesTypeToString(eDataType, instanceValue);
			case InteractionprotocolsPackage.SYNCHRONIZATION_TYPE:
				return convertSynchronizationTypeToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BusinessMessage createBusinessMessage() {
		BusinessMessageImpl businessMessage = new BusinessMessageImpl();
		return businessMessage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InteractionProtocol createInteractionProtocol() {
		InteractionProtocolImpl interactionProtocol = new InteractionProtocolImpl();
		return interactionProtocol;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InteractionPath createInteractionPath() {
		InteractionPathImpl interactionPath = new InteractionPathImpl();
		return interactionPath;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Lifeline createLifeline() {
		LifelineImpl lifeline = new LifelineImpl();
		return lifeline;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Termination createTermination() {
		TerminationImpl termination = new TerminationImpl();
		return termination;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Condition createCondition() {
		ConditionImpl condition = new ConditionImpl();
		return condition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TimeConstraint createTimeConstraint() {
		TimeConstraintImpl timeConstraint = new TimeConstraintImpl();
		return timeConstraint;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TimeObservation createTimeObservation() {
		TimeObservationImpl timeObservation = new TimeObservationImpl();
		return timeObservation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ProtocolReference createProtocolReference() {
		ProtocolReferenceImpl protocolReference = new ProtocolReferenceImpl();
		return protocolReference;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Correlation createCorrelation() {
		CorrelationImpl correlation = new CorrelationImpl();
		return correlation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Role createRole() {
		RoleImpl role = new RoleImpl();
		return role;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public And createAnd() {
		AndImpl and = new AndImpl();
		return and;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Or createOr() {
		OrImpl or = new OrImpl();
		return or;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Xor createXor() {
		XorImpl xor = new XorImpl();
		return xor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public If createIf() {
		IfImpl if_ = new IfImpl();
		return if_;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Loop createLoop() {
		LoopImpl loop = new LoopImpl();
		return loop;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ar.edu.utn.frsf.cidisi.upcolbpip.interactionprotocols.Exception createException() {
		ExceptionImpl exception = new ExceptionImpl();
		return exception;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Cancel createCancel() {
		CancelImpl cancel = new CancelImpl();
		return cancel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MultipleInstance createMultipleInstance() {
		MultipleInstanceImpl multipleInstance = new MultipleInstanceImpl();
		return multipleInstance;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Transaction createTransaction() {
		TransactionImpl transaction = new TransactionImpl();
		return transaction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Compensation createCompensation() {
		CompensationImpl compensation = new CompensationImpl();
		return compensation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TerminationElement createTerminationElementFromString(EDataType eDataType, String initialValue) {
		TerminationElement result = TerminationElement.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertTerminationElementToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LoopType createLoopTypeFromString(EDataType eDataType, String initialValue) {
		LoopType result = LoopType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertLoopTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MultipleInstancesType createMultipleInstancesTypeFromString(EDataType eDataType, String initialValue) {
		MultipleInstancesType result = MultipleInstancesType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertMultipleInstancesTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SynchronizationType createSynchronizationTypeFromString(EDataType eDataType, String initialValue) {
		SynchronizationType result = SynchronizationType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertSynchronizationTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InteractionprotocolsPackage getInteractionprotocolsPackage() {
		return (InteractionprotocolsPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static InteractionprotocolsPackage getPackage() {
		return InteractionprotocolsPackage.eINSTANCE;
	}

} //InteractionprotocolsFactoryImpl
